home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / GAMES / MONOPOLY.ARC / !DataSuite / Docs / DtLoadHelp next >
Text File  |  1994-04-28  |  47KB  |  916 lines

  1.  DataVoxLoader Help File.
  2.  ========================
  3.  
  4.    This module complements the DataVox Module by loading and storing in
  5.  RMA the data files for play. This module requires the DataVox module to
  6.  be memory resident to both be loaded and for it to work. Removing the
  7.  DataVox module while this one is loaded is a dangerous move and may cause
  8.  undefined results (Read a machine crash.) to occur.
  9.  
  10.  The Concepts of DataLoad
  11.  ========================
  12.  
  13.    DataLoad provides a system of slots (or really logical sound channels)
  14.  to which files can be loaded and which can be related to real sound
  15.  channels. The mapping goes something like this:-
  16.  
  17.              +------+
  18.  File -----> | Slot | ---------+
  19.  ...         | ...  |          |      +------------+
  20.  ...         | ...  |          +----> | DataVox    |
  21.  ...         | ...  | --------------> | channel(s) |
  22.  ...         | ...  |          +----> +------------+
  23.  ...         | ...  | ---------+
  24.  File------> | Slot |
  25.              +------+
  26.  
  27.  The current version of DataLoad supports 1024 slots but this may be changed
  28.  at a later date and must not be counted on. Use the DataLoad_SlotsFree SWI
  29.  to find out how many slots are available instead.
  30.  
  31.    The slots may be linked freely to as many or as few DataVox channels as
  32.  desired. Also any data written to a slot linked to a DataVox channel or
  33.  channels will be automatically passed on to those channels for you. This
  34.  means your application need never touch DataVox for most operations other
  35.  than claiming channels from it.
  36.  
  37.  OSCLI Commands
  38.  ==============
  39.  
  40.  *DataLoadStatus
  41.    This command reads out the status of the logical channels in use in 
  42.  DataLoad. It informs you of their address,length,assignment & name.
  43.  Syntax: *DataLoadStatus
  44.  
  45.  *DataLoad_Load
  46.    This command loads files into DataLoad Slots for use. The Stereo flag
  47.  only has effect when the sample being loaded is stereo and not supplying
  48.  the DataVox channel to assign to causes the file to be simply loaded and
  49.  not assigned. Files that are recognised are Armadeus sample,DSEdit raw
  50.  sample,Amiga IFF 8SVX sample,Tracker sample,SUN audio file and ,of course,
  51.  the DataVox file. All bar the DataVox type III,Amiga IFF 8SVX,SUN audio
  52.  file & Tracker samples are recognised by their file type alone. The SUN
  53.  audio file,Amiga IFF 8SVX & Tracker samples are recognised by their file
  54.  contents. DataVox type III files are recognised by both their contents and
  55.  their filetype.
  56.  Syntax: *DataLoad_Load <filename> [DataVox channel] [Stereo Flag]
  57.  
  58.  *DataLoad_Save
  59.    This command saves a DataLoad Slot back to a file. All settings held by
  60.  the slot will be saved with the file. The file will be a DataVox file.
  61.  Syntax: *DataLoad_Save <filename> <DataLoad Slot>
  62.  
  63.  *DataLoad_AssignSlot
  64.    This command assigns a DataLoad Slot to a DataVox channel for play. If no
  65.  stereo flag is given and the sample is stereo then 0 is assumed.
  66.  Syntax: *DataLoad_AssignSlot <DataLoad Slot> <DataVox channel> [Stereo flag]
  67.  
  68.  *DataLoad_DeAssignSlot
  69.    This command deassigns a DataLoad Slot from a DataVox channel.
  70.  Syntax: *DataLoad_DeAssignSlot <DataLoad Slot> <DataVox channel>
  71.  
  72.  *DataLoad_ClearSlot
  73.    This command clears a DataLoad Slot - delinking DataVox from any 
  74.  references to it and releasing the claimed space back into the RMA.
  75.  Syntax: *DataLoad_ClearSlot <DataLoad Slot>
  76.  
  77.  SWI Commands
  78.  ============
  79.  
  80.  DataLoad_Load
  81.   On Entry :-
  82.    R0 file name/path pointer.
  83.    R1 channel. 0 for just load.
  84.    R2 Stereo bias if sample is stereo - 0 for Left 1 for Right.
  85.   On Exit  :-
  86.    R0 Data Load Slot assigned.
  87.    R1 file format recognised string. (0 for not recognised.)
  88.    R2 preserved.
  89.   Errors :-
  90.    I do not understand the format of this file - it is too new.
  91.    No free DataLoad Slots available.
  92.    This is not a file.
  93.    Insufficient RMA Space to Load file.
  94.    Bad DataVox channel to load to.
  95.    Bad Stereo Assignment - 0 or 1 please.
  96.   Use :-
  97.         This SWI handles the loading of files into the RMA for use,allocating
  98.   them to a DataVox channel using the stereo flag if the sample being loaded
  99.   is stereo. It hands back to you a Slot number which is to be used to
  100.   reference the sample. This is for multi-tasking usage of the module and
  101.   it is expected that applications do *not* reference any slots but those
  102.   given to them. Also any filing system error can be reported back by this
  103.   routine as well as the errors listed above.
  104.  
  105.        The loader code recognises and will interpret data from :-
  106.  
  107.   DataVox files v1,v2 & v3. (All flags. surprise surprise! :-) )
  108.   Armadeus sample files.    (Data type and sample speed)
  109.   DSEdit raw sample files.  (Data type)
  110.   Tracker sample files.     (Data type & Repeat points)
  111.   Amiga IFF 8SVX files.     (Data type,stereo flag and sample speed)
  112.   SUN Audio files.          (Data type and sample speed)
  113.   
  114.   Any file not mentioned above will be loaded but no interpretation is made
  115.   on them and simple default values are assigned of :- Linear unsigned data type
  116.   ,&2600 pitch,repeat block the whole file. So you can load and play text
  117.   files if you *really* want to. The Amiga IFF,Tracker & SUN file formats
  118.   are recognised by their internal contents and can be any file type. If the
  119.   file loaded is a compressed file (DataVox v3 supports this) then it
  120.   will *not* be assigned to the DataVox channel requested but it will be
  121.   loaded in memory. DataVox type III files will also be recognised by their
  122.   file contents and will be correctly loaded regardless of their filetype.
  123.  
  124.         The number returned in R1 signals the kind of file recognised by
  125.   providing a pointer to a null terminated string that names the format loaded.
  126.   If zero is returned then the file format was unrecognised and default values
  127.   were be arranged.
  128.  
  129.   N.B. Please note DataLoad assumes that the Tracker and IFF headers are
  130.   well defined chunks and can react strangely to corrupted headers. It
  131.   shouldn't crash but merely do unexpected things like play more data than
  132.   there is in the file resulting in RMA being played.
  133.  
  134.  DataLoad_Save
  135.   On Entry:-
  136.    R0=Pointer to path/filename.
  137.    R1=DataLoad Slot number.
  138.   On Exit:-
  139.    R0,R1 preserved.
  140.   Errors:-
  141.    Bad DataLoad Slot.
  142.   Use:-
  143.        Not unsurprisingly this SWI saves a DataLoad Slot back to a file.
  144.   All flags etc set by the DataLoad_WriteData SWI will be saved in the file.
  145.   The files are always DataVox type 3 files. Also filing system errors can
  146.   be reported back as well as the error listed above. It also updates
  147.   DataLoad's copy of the full path name for the file. However if memory is
  148.   very tight this update may not be possible in which case the path given
  149.   by the last load/save operation to this slot will be retained. Accordingly
  150.   applications should not make any assumptions that this path will always be
  151.   updated.
  152.  
  153.  DataLoad_AssignSlot
  154.   On Entry:-
  155.    R0 = DataLoad Slot to be assigned.
  156.    R1 = DataVox Channel.
  157.    R2 = Stereo assignment (0 or 1 as per DataLoad_Load)
  158.   On Exit:-
  159.    R0,R1,R2 preserved
  160.   Errors:-
  161.    Bad DataVox Channel to assign to.
  162.    Bad DataLoad Slot to assign.
  163.    Bad DataLoad Slot to assign - Block is compressed.
  164.    Bad Stereo flag - 0 or 1 please.
  165.   Use:-
  166.        This SWI assigns a DataLoad Slot to the DataVox channel specified.
  167.   All flags etc will be set up for you and the channel will be pointed at
  168.   the correct block of memory. More importantly DataLoad will take note
  169.   that this Slot is assigned to that DataVox channel and will ensure that
  170.   that channel is from here on in is pointing at the right memory. This is
  171.   important as it allows DataLoad to clean up after itself where needed
  172.   and ensure that DataVox is not pointing at an invalid block of memory.
  173.   Thus it is reccomended that you use this SWI for all references to
  174.   files held by DataLoad. Please note that if the sample being assigned is
  175.   not stereo then the stereo flag will be ignored.
  176.  
  177.  DataLoad_DeAssignSlot
  178.   On Entry:-
  179.    R0 = DataLoad Slot to be deassigned.
  180.    R1 = DataVox Channel it was assigned to.
  181.   On Exit:-
  182.    R0,R1 preserved.
  183.   Errors:-
  184.    Bad DataVox Slot to deassign.
  185.    Bad DataLoad Slot to deassign.
  186.    This DataLoad Slot is not assigned to that DataVox channel!
  187.   Use:-
  188.        This SWI delinks a DataLoad slot from a DataVox channel when needed.
  189.   It also informs DataLoad that it does not need to ensure that that DataVox
  190.   channel is pointing to valid data anymore. All settings on the DataVox
  191.   channel are unset. If play synthesis is occuring when the de-assignment
  192.   is requested then play synthesis will be stopped before the slot's data
  193.   is junked.
  194.  
  195.  DataLoad_ClearSlot
  196.   On Entry:-
  197.    R0=DataLoad Slot to clear.
  198.   On Exit:-
  199.    R0 preserved.
  200.   Error:-
  201.    Bad DataLoad Slot to Clear.
  202.   Use:-
  203.        This SWI clears a DataLoad slot releasing any memory held by it back
  204.   to the RMA and delinking any DataVox channels that reference that Slot.
  205.   Please note this function is only properely performed if the Slot was
  206.   linked using the DataLoad_AssignSlot SWI and not if an application did
  207.   the linking itself.
  208.  
  209.  DataLoad_ReadData
  210.   On Entry:-
  211.    R0 Reason Code.
  212.    R1 DataLoad Slot to Read.
  213.   On Exit:-
  214.    R0,R1 preserved.
  215.    R2 Data wanted.
  216.   Errors:-
  217.    Unknown Read operation.
  218.    Bad DataLoad Slot to read.
  219.    Bad DataLoad Slot to read - no data linked to it.
  220.   Use:-
  221.        This is a general purpose reading SWI that allows you to read the
  222.   various settings of a DataLoad Slot. Precisely what data is returned is
  223.   governed by the reason code used and these are listed below.
  224.  
  225.    Reason Code | Data Read
  226.    ------------+-----------------------------------------------------------
  227.        0       | Data type of the slot. 0 Logarithmic,1 Linear Unsigned,
  228.                |  2 Linear signed & 3 Ulaw Logarithmic format.
  229.                |
  230.        1       | Timer flag of the slot. 1 for timed play ,0 otherwise.
  231.                |
  232.        2       | Reverse flag of the slot. 1 for reverse play ,0 otherwise.
  233.                |
  234.        3       | Fixed pitch flag. If this is set then the fixed pitch
  235.                |  read by reason code 6 will be used when the slot is
  236.                |  assigned to a DataVox channel.
  237.                |
  238.        4       | Stereo flag. 1 for a stereo slot. Only if this flag is set
  239.                |  will the stereo flag passed to the Load & AssignSlot calls
  240.                |  have any effect.
  241.                |
  242.        5       | Compressed flag. 1 for a compressed slot ,0 otherwise. If 
  243.                |  this flag is set then the slot can not be assigned to
  244.                |  a channel.
  245.                |
  246.        6       | Pitch. This reads the pitch setting of a slot. The pitch
  247.                |  given is a standard Arc one in the range 0-&8000 as used
  248.                |  by the sound system. 0 indicates no fixed pitch and
  249.                |  supercedes the fixed pitch flag.(if set) N.B. pitches
  250.                |  returned by this SWI are always scaled to a 48 us system
  251.                |  speed. If the current system speed is different from
  252.                |  48 us then this pitch will be different from the actual
  253.                |  pitch in use.
  254.                |
  255.        7       | DataOffset - this gives the offset from the start of the
  256.                |  slot block to the actual Data to be played.
  257.                |
  258.        8       | RepeatStart - this is an offset from the start of the
  259.                |  slot block to the start of the repeat block.
  260.                |
  261.        9       | RepeatEnd - this is an offset from the start of the slot
  262.                |  slot block to the end of the repeat block.
  263.                |
  264.        10      | Uncompressed Size - this is the size of the block
  265.                |  uncompressed. If the file is already uncompressed then
  266.                |  this will simply be the total size of the block and the
  267.                |  total size of the file held in memory but if the file is
  268.                |  compressed then this is the total size of the block of
  269.                |  memory holding the file. This is for file compression
  270.                |  as supported by DataLoad.
  271.                |
  272.        11      | UpCall Offset. This reads the offset from the start of the
  273.                |  slot block to the slots UpCall code (if any). If UpCall
  274.                |  code is present then this will always be word sized
  275.                |  otherwise it is always zero.
  276.                |
  277.        12      | BufferStart. This returns the absolute memory address of the
  278.                |  start of the slot block.
  279.                |
  280.        13      | BufferLength. This returns the total length of the slot 
  281.                |  block. This should be identical to the Uncompressed
  282.                |  size but does not have to be. (It should never be smaller
  283.                |  than it though for average cases.)
  284.                |
  285.        14      | SlotName. This returns a pointer to the null terminated
  286.                |  leaf string of the slot name.
  287.                |
  288.        15      | 16 bit flag. 1 for a sixteen bit sample, 0 otherwise.
  289.                |
  290.        16      | FullSlotName. This returns a pointer to the null terminated
  291.                |  full path, as given to DataLoad, for that slot.
  292.  
  293.   This SWI should be the only way in which applications interrogate what the
  294.   settings of a DataLoad slot are.
  295.  
  296.  DataLoad_WriteData
  297.   On Entry:-
  298.    R0 Reason Code.
  299.    R1 DataLoad Slot to Write.
  300.    R2 Data to Write.
  301.   On Exit:-
  302.    R0,R1,R2 preserved.
  303.   Errors:-
  304.    Unknown Write operation.
  305.    Bad DataLoad Slot to write - no data linked to it.
  306.    Bad DataLoad Slot to write.
  307.   Use:-
  308.        This is a general purpose SWI for setting a DataLoad Slots settings.
  309.   Any DataVox channels assigned to this Slot by the AssignSlot SWI will be
  310.   automatically updated to reflect the new settings. Each reason code has
  311.   its own extra error message associated with it and the reason codes &
  312.   error messages are :-
  313.                        
  314.   Reason Code | Comment
  315.   ------------+-----------------------------------------------------------
  316.        0      | Writes the Slots data type. (0,1,2 or 3)
  317.               | Error:- Bad DataType to Write.
  318.               |
  319.        1      | Sets the Slots timed flag. (0 or1)
  320.               | Error:- Bad Timer Flag to Write.
  321.               |
  322.        2      | Writes the Slots reverse flag. (0 or 1)
  323.               | Error:- Bad Reverse Flag to Write.
  324.               |
  325.        3      | Writes the Slots fixed pitching flag. (0 or 1)
  326.               | Error:- Bad Pitch Flag to Write.
  327.               |
  328.        4      | Writes the Slots stereo flag. (0 or 1)
  329.               | This automatically delinks all DataVox channels from this
  330.               | slot.
  331.               | Error:- Bad Stereo Flag to Write.
  332.               |
  333.        5      | Writes the Slots compressed flag. (0 or 1)
  334.               | Error:- Bad Compressed Flag to Write.
  335.               |
  336.        6      | Writes the Slots pitch. (0-&8000)
  337.               | Error:- Bad Pitch to Write.
  338.               |
  339.        7      | Writes the Slots DataOffset. (32-Block Size)
  340.               | Error:- Bad Data Offset to Write.
  341.               |
  342.        8      | Writes the Slots Repeat Start Offset. (32-Block Size)
  343.               | Error:- Bad Repeat Start Offset to Write.
  344.               |
  345.        9      | Writes the Slots RepeatEnd Offset. 
  346.               | (Repeat Start Offset-Block Size)
  347.               | Error:- Bad Repeat End Offset to Write.
  348.               |
  349.        10     | Writes the Slots Uncompressed Size. (32-What Ever)
  350.               |
  351.        11-14  | Reserved for future expansion.
  352.               |
  353.        15     | Writes the Slots sixteen bit flag. (0 or 1)
  354.               | Error:- Bad 16 bit Flag to Write.
  355.               |
  356.        16     | Reserved for future expansion.
  357.  
  358.  DataLoad_SlotsFree
  359.   On Entry:-
  360.    R0,R1 Undefined.
  361.   On Exit:-
  362.    R0 No. Unallocated channels.
  363.    R1 No. Allocated channels.
  364.   Errors:-
  365.    none.
  366.   Use:-
  367.        This returns the number of Allocated and Unallocated channels
  368.   maintained by DataLoad. This allows applications to query if sufficient
  369.   slots are available for use.
  370.  
  371.  DataLoad_CreateSlot
  372.   On Entry:-
  373.    R0 Pointer to Name.
  374.    R1 Size of Data.
  375.    R2 Type of Data.
  376.   On Exit:-
  377.    R0 Slot No.
  378.    R1 Ptr to Start of Buffer. (first byte of data after header data.)
  379.    R2 Ptr to End of Buffer.
  380.   Errors:-
  381.    No free slots to Create Slot into.
  382.    Insufficient RMA space to Create Slot.
  383.    This is a silly size to Create a Slot to!
  384.   Use:-
  385.        This SWI allows you to create an empty slot for use. This is primarily
  386.    intended for Sound Samplers to use but anyone who needs to create a Slot
  387.    can use this. The Slot is pre-initialised to an appropriate set of
  388.    values and is cleared out to 'zero sound'. Exactly what the slot is filled
  389.    with is decided by the Data Type. Please note that due to the way the RMA
  390.    allocates blocks the delivered space may be a few bytes *larger* (never
  391.    smaller) than requested. NB The size passed is assumed to be *sans*
  392.    header and sufficient space for a header will be automatically added to
  393.    this size before allocation occurs.
  394.  
  395.  DataLoad_ExtendSlot
  396.   On Entry:-
  397.    R0 DataLoad Slot to extend.
  398.    R1 Signed integer of amount to extend.
  399.   On Exit:-
  400.    R0 & R1 preserved.
  401.   Errors:-
  402.    Bad DataLoad Slot to Extend.
  403.    Bad DataLoad Slot to Extend - no data linked to it.
  404.    Bad Size to Extend by! This makes the slot smaller than header size!.
  405.    No Room in RMA for Block Extension.
  406.   Use:-
  407.        This allows you to alter the size of an existing slot to whatever
  408.   is needed. If the Slot is extended in size then the extended area is
  409.   automatically cleared to 'zero-sound' for you. If any channels are
  410.   linked to this slot then they are unlinked automatically. Please note that
  411.   any size given is expected to be *inclusive* of the 32 bytes of header
  412.   space.... Changes are currently *not* echoed to any assigned channels....
  413.  
  414.   N.B. This SWI assumes you know what you are doing and does *not* adjust
  415.   most of the header information. Therefore care should be exercised in its
  416.   use.... It does perform clipping though to ensure that certain offsets are
  417.   still valid.
  418.  
  419.   N.N.B. Using an adjust size of 0 will cause the RMA to reshuffle the block
  420.   in memory, allowing you to force the RMA to try and relocate the block as
  421.   low in memory as possible. Care must be taken though to ensure this trick
  422.   is only used when sufficient free memory *below* the block is available
  423.   else the block could be shuffled up higher in the RMA.
  424.  
  425.  DataLoad_Version
  426.   On Entry:-
  427.    R0 Undefined
  428.   On Exit:-
  429.    R0 Version Number * 100 
  430.   Errors:-
  431.    none
  432.   Use:-
  433.        Fairly self explanitory really.
  434.  
  435.  DataLoad_QueryAssign
  436.   On Entry:-
  437.    R0 DataVox channel to query.
  438.   On Exit:-
  439.    R0 Slot number attached to that channel. (0 if none)
  440.   Errors:-
  441.    Bad real channel to query.
  442.   Use:-
  443.        This allows applications to intelligently decide whether or not an
  444.   allocation call is needed. This is because allocation calls are time
  445.   intensive compared to this SWI and an application may wish to avoid
  446.   unecessary delays where possible.
  447.  
  448. Error Messages
  449. ==============
  450.  
  451.    The Error range begins at &806180, ends at &8061BF, and here is the error
  452. message list. This list only comprises errors generated *by* DataLoad, errors
  453. from filing systems will be reported back as appropriate too.
  454.  
  455.    Error # | Error Message
  456.    --------+-------------------------------------------------------------
  457.      0     | DataVox is not loaded in memory. I cannot initialise!
  458.      1     | DataLoad is in use.
  459.      2     | Bad DataVox channel to assign the file to.
  460.      3     | Bad Stereo flag.
  461.      4     | Bad Slot number to save.
  462.      5     | Insufficient RMA Space to Initialise!
  463.      6     | Unknown DataLoad operation.
  464.      7     | I do not understand the format of this file - it is too new.
  465.      8     | No free DataLoad Slots available.
  466.      9     | This is not a file.
  467.      10    | Insufficient RMA Space to Load file.
  468.      11    | Bad DataVox channel to load to.
  469.      12    | Bad Stereo Assignment - 0 or 1 please.
  470.      13    | Bad DataLoad Slot.
  471.      14    | Bad DataVox Channel to assign to.
  472.      15    | Bad DataLoad Slot to assign.
  473.      16    | Bad DataLoad Slot to assign - Block is compressed.
  474.      17    | Bad Stereo flag - 0 or 1 please.
  475.      18    | Bad DataVox Slot to deassign.
  476.      19    | Bad DataLoad Slot to deassign.
  477.      20    | This DataLoad Slot is not assigned to that DataVox channel!
  478.      21    | Bad DataLoad Slot to Clear
  479.      22    | Unknown Read operation.
  480.      23    | Bad DataLoad Slot to read.
  481.      24    | Bad DataLoad Slot to read - no data linked to it.
  482.      25    | Unknown Write operation.
  483.      26    | Bad DataLoad Slot to write.
  484.      27    | Bad DataLoad Slot to write - no data linked to it.
  485.      28    | Bad DataType to Write.
  486.      29    | Bad Timer Flag to Write.
  487.      30    | Bad Reverse Flag to Write.
  488.      31    | Bad Pitch to Write.
  489.      32    | Bad Data Offset to Write.
  490.      33    | Bad Repeat Start Offset to Write.
  491.      34    | Bad Repeat End Offset to Write.
  492.      35    | Bad Stereo Flag to Write.
  493.      36    | Bad Compressed Flag to Write.
  494.      37    | Bad Pitch Flag to Write.
  495.      38    | Bad 16 bit Flag to Write.
  496.      39    | No free slots to Create Slot into.
  497.      40    | Insufficient RMA space to Create Slot.
  498.      41    | This is a silly size to Create a Slot to!
  499.      42    | Bad datatype to Create a Slot with!
  500.      43    | Bad DataLoad Slot to Extend.
  501.      44    | Bad DataLoad Slot to Extend - no data linked to it.
  502.      45    | Bad Size to Extend by! This makes the slot smaller than header
  503.            |   size!
  504.      46    | No Room in RMA for Block Extension.
  505.      47    | Bad real channel to query.
  506.  
  507.  DataVox File Format
  508.  ===================
  509.  
  510.    Consists of eight header words then pure sample data in the newest format.
  511.  However the two older formats are supported for load only and are noted here
  512.  as well. Any bits whose function is not specifically stated should always be
  513.  cleared to zero as they are reserved for future expansion. Filetype &108 is
  514.  the officially allocated type for these files.
  515.  
  516.   File Format 1
  517.   -------------
  518.  
  519.                         Byte | Comment
  520.                         -----+------------------------------------------
  521.                            0 | Data Type. Currently in the range 0-2.
  522.                              |   0 Log, 1 Linear Unsigned & 2 Linear
  523.                              |   Signed.
  524.                            1 | Flag Byte. Bit 0 set for timed unset for
  525.                              |   untimed.Bit 1 set for fixed pitching 0
  526.                              |   for normal play.
  527.                          2-3 | 16 bit pitch value for sample.
  528.                           4  | 32 bit offset from header start to data.
  529.                              |   8 for this format.
  530.                           8+ | Sample data.
  531.  
  532.   File Format 2
  533.   -------------
  534.              
  535.                       Byte   | Comment
  536.                       -------+------------------------------------------
  537.                            0 | Data Type. Currently in the range 0-2.
  538.                              |   0 Log, 1 Linear Unsigned & 2 Linear
  539.                              |   Signed.
  540.                            1 | Flag Byte. Bit 0 set for timed unset for
  541.                              |   untimed.Bit 1 set for reversed play 0
  542.                              |   for normal play. Bit 2 set for fixed
  543.                              |   pitching 0 for normal.
  544.                          2-3 | 16 bit pitch value for sample.
  545.                          4-7 | 32 bit offset from header start to data.
  546.                              |   16 for this format.
  547.                         8-11 | 32 bit offset to start of repeated data.
  548.                        12-15 | 32 bit offset to end of repeated data.
  549.                          16+ | Sample data.
  550.  
  551.   File Format 3
  552.   -------------
  553.  
  554.                       Byte   | Comment
  555.                       -------+-----------------------------------------
  556.                            0 | Data Type. Currently in the range 0-3.
  557.                              |   0 Log, 1 Linear Unsigned, 2 Linear
  558.                              |   Signed & Ulaw Logarithmic.
  559.                            1 | Flag Byte.
  560.                              |   Bit 0 set for timed play.
  561.                              |   Bit 1 set for reversed play.
  562.                              |   Bit 2 set for fixed pitching.
  563.                              |   Bit 3 set for stereo sample.
  564.                              |   Bit 4 set for compressed sample.
  565.                              |   Bit 5 set for 16 bit data.
  566.                          2-3 | 16 bit pitch value for sample.
  567.                              |   If bit 15 is set then the number is a
  568.                              |   negative number with the top 16 bits
  569.                              |   assumed to be &FFFF.
  570.                          4-7 | 32 bit offset from header start to data.
  571.                              |   Usually 32 for this format.
  572.                         8-11 | 32 bit offset to start of repeated data.
  573.                        12-15 | 32 bit offset to end of repeated data.
  574.                        16-19 | 32 bit "DVOX" ID Word. (&584F5644)
  575.                        20-23 | 32 bit Version Number. (3)
  576.                        24-27 | 32 bit Offset to Upcall Code.
  577.                        28-31 | 32 bit Uncompressed File Size.
  578.                         32+  | Sample data.
  579.  
  580.  
  581.    Formats 1 & 2 are provided purely for compatability reasons whereas
  582.  Format 3 is the format currently used. The layout of the file must be :-
  583.  
  584.     +----------+--------+-----------------+
  585.     | Header   | UpCall | Sample          |
  586.     | 32 bytes | Code   | Data            |
  587.     +----------+--------+-----------------+
  588.  
  589.  The UpCall code must be between the sample data and the header information
  590.  and it is the Editors responsibility to ensure that the UpCall code is
  591.  kept valid if the Block size is altered.
  592.  
  593.    If the sample is stereo then the file looks something like this :-
  594.  
  595.     +----------+--------+---------------+---------------+
  596.     | Header   | UpCall | Sample        | Sample        |
  597.     | 32 bytes | Code   | Data   Part A | Data   Part B |
  598.     +----------+--------+---------------+---------------+
  599.  
  600.  Where part A is refered to by Stereo flag setting 0 & part B referred to
  601.  as Stereo flag 1. Please note to determine the boundary between part A &
  602.  part B the following calculation is used :-
  603.  
  604.  Part A Start Offset :- Data Offset
  605.         End   Offset :- Data Offset + ((Length of Block - Data Offset)/2)
  606.  Part B Start Offset :- Data Offset + ((Length of Block - Data Offset)/2)
  607.         End   Offset :- Length of Block
  608.  
  609.  If the sample is a 16 bit one then the sample data is further sub-divided
  610.  into two sections :-
  611.                                   
  612.   +---------------+--------------+
  613.   | Sample Data   | Sample Data  |
  614.   |   high bytes. |   low bytes. |
  615.   +---------------+--------------+
  616.  
  617.  Each of these sections is exactly half of the original size of the data
  618.  section. Of the two sections only the high bytes will be actually played
  619.  as the archimedes sound system is currently capable of only outputing 
  620.  eight bit samples. Other than this change the data area is treated
  621.  identically....
  622.  
  623.    Also an area is being reserved for applications. This area will be totally
  624.  ignored by DataLoad but may be used by applications to add `supplemental`
  625.  data that they feel the sample needs. The idea is data like, date of
  626.  sampling, textual note as to what the sample is, etc... will be stored
  627.  here. In no way is *anything* required to be stored here however. It is
  628.  a chunk based area where each chunk is headed by two words.
  629.  
  630.   Chunk format :-
  631.  
  632.   Byte | Comment
  633.   -----+-----------------------------------------------------------------
  634.   0-3  | An ID word identifying what the chunk is. All chunk ID's should
  635.        |   be registered with me to avoid name collision.
  636.   4-7  | A length word. Relative to the start of the chunk this should be
  637.        |   word sized length of the chunk in bytes. All chunks *must* be
  638.        |   word sized.
  639.   8+   | Chunk data. This is entirely arbitrary to the chunk....
  640.  
  641.   This area is placed between the header data and before the UpCall code (if
  642.   any is present.) otherwise it is before the Sample Data. Like so:-
  643.  
  644.     +----------+-------------+--------+-----------------+
  645.     | Header   | Application | UpCall | Sample          |
  646.     | 32 bytes | Area        | Code   | Data            |
  647.     +----------+-------------+--------+-----------------+
  648.  
  649.   Currently defined chunks are:-
  650.  
  651.   Chunk ID         | Comment
  652.   -----------------+----------------------------------------------------
  653.   `Date` &65746144 | A five byte time detailing the date of sampling. The
  654.                    |   format of the bytes is as per OS_Word 14,3.
  655.   `Name` &656D614E | A null terminated string detailing the long name of
  656.                    |   the sample.
  657.   `Note` &65746F4E | A null terminated textual string detailing something
  658.                    |   about the sample.(Intended to store human readable
  659.                    |   interesting data.)
  660.  
  661.    Next the Upcall area is organised into two distinct types. There is the
  662.  `custom` uneditable type that has been presumably created for a special
  663.  purpose and there is the editable type. The two are distinguished by the
  664.  first word of the upcall area being a `UpCl` or &6C437055. If this word
  665.  is present the next few words are in a special format. This looks like
  666.  this :-
  667.  
  668.   Bytes  | Comment
  669.   -------+----------------------------------------
  670.    0-3   |  ID Word `UpCl`.
  671.    4-7   |  Offset to entry point for UpCall code.
  672.    8-11  |  ID Word (for Editors)
  673.    11+   |  Version Dependant Jump table.
  674.  
  675.   The offset(s) contained in the code should (bar internal to your code) all
  676. be relative to byte 0 or the start of the upcall area. The ID word is purely
  677. for Editors to be able to identify the type of upcall code being used. The
  678. word is divided into two 16 bit parts. The high 16 bits (bits 31-16) contain
  679. the *type* of upcall code contained. This should be a number in the range 
  680. 0-65535 and dictates how the next few words should be interpreted. The low
  681. 16 bits is the minor version number * 100. This allows for each major type
  682. of upcall code to have its own version type and history as required.
  683.  
  684.   After the first three words the next few words format is totally dictated
  685. by the major version number. Editors encountering a major version number
  686. that they don't understand should refuse to allow editing of the upcall
  687. code. (Removal yes but not editing.) There is currently only one defined
  688. upcall type but again I expect this to change. To register your particular
  689. type of upcall code you must send all the details and some example source
  690. code of it (and some examples would be nice) to me. I will then assign it a
  691. major type number and note the neccesary details that an editor will need to
  692. know here. A short descriptive name of the purpose of the upcall code is
  693. needed too.
  694.  
  695.   Some general points to remember about Upcall code are that the code is
  696. being called under interupts so re-entrancy is vital. Basically stacking
  697. R0-R12 & R14 along with keeping references to workspace to a minimum in the
  698. Upcall update code will ensure this. Of course calling SWI's from the
  699. primary update code is ill advised. Only do that if you really *must*! Other
  700. than that coding UpCall code with all the restrictions that interupt code
  701. has is the best course.
  702.  
  703.  Upcall types:-
  704.  --------------
  705.    
  706.   +--------------+---------------------------------------------------------+
  707.   |Version No.s  | Comment/Notes.                                          |
  708.   +------+-------|                                                         |
  709.   |Major | Minor |                                                         |
  710.   +------+-------+---------------------------------------------------------+
  711.   | 0    | 0.04  | Description - Table Sequenced Song.                     |
  712.   |      |       | Uses - 4 extra header words.                            |
  713.   |      |       |  bytes 12-15 are the offset to a Pitch Table which is   |
  714.   |      |       |   laid out two words per entry.                         |
  715.   |      |       |   Word 0 16 bit number - total number of pitches held in|
  716.   |      |       |     the table. 0 indicates no pitches are held. The top |
  717.   |      |       |     16 bits reserved for future expansion.              |
  718.   |      |       |   Word 1 The system speed in micro seconds this table is|
  719.   |      |       |     calibrated for. All 24 other bits reserved for      |
  720.   |      |       |     future expansion.                                   |
  721.   |      |       |   Word n*2 (where n is a index  number) is the 16 bit   |
  722.   |      |       |     pitch.                                              |
  723.   |      |       |   Word n*2+1 is the internal format phase accumulator   |
  724.   |      |       |     pitch. (IE the value returned from SWI "Sound_Pitch"| 
  725.   |      |       |     shifted down by 16 bits.)                           |
  726.   |      |       |  Bytes 16-19 are the offset to a Start Address Table    |
  727.   |      |       |    which is laid out one word per entry.                |
  728.   |      |       |   Word 0 is a 16 bit number - total number of Start     |
  729.   |      |       |     Addresses held. Top 16 bits reserved.               |
  730.   |      |       |   Word n (where n is an index number) is the 32 bit     |
  731.   |      |       |     offset from the start of data to the actual start   |
  732.   |      |       |     for this entry.                                     |
  733.   |      |       |   Bytes 20-23 are the offset to an End Address Table    |
  734.   |      |       |    which is laid out in an indentical fashion to the    |
  735.   |      |       |    start address table.                                 |
  736.   |      |       |   Bytes 24-27 are the offset to the Sequence Table.     |
  737.   |      |       |    Two words per entry.                                 |
  738.   |      |       |    Word 0 16 bit number - total number of sequences     |
  739.   |      |       |      held. top 16 bits reserved.                        |
  740.   |      |       |    Word 1 reserved for future expansion.                |
  741.   |      |       |    Word n*2 (where n is an index number) :-             |
  742.   |      |       |      top 16 bits - Start Address index number           |
  743.   |      |       |      low 16 bits - End Address index number             |
  744.   |      |       |    Word n*2+1 :-                                        |
  745.   |      |       |      top 16 bits - Reserved for future expansion.       |
  746.   |      |       |      low 16 bits - Pitch index number.                  |
  747.   |      |       |  This is a very simple system designed purely for speed.|
  748.   +------+-------+---------------------------------------------------------+
  749.  
  750.    Finally DataLoad allows for the concept of a compressed file. The layout
  751.  of a compressed file is :-
  752.                                            
  753.     <------------File Length-------------->
  754.     <------------Block Length in Memory-------------->
  755.     +----------+--------+--------+--------+- - - - - +
  756.     | Header   | UpCall | Header | Sample |          |
  757.     | 32 bytes | Code   | Byte   | Data   |          |
  758.     +----------+--------+--------+--------+- - - - - +
  759.     <---Data Offset---->
  760.  
  761.  The data offset points to a header byte that identifies the compression
  762.  method used on the data ,followed by the compressed sample data. DataLoad
  763.  does not have any compression routines in it and will refuse to allow a
  764.  compressed sample to be linked to a DataVox channel. Instead it is the
  765.  applications responsibility to uncompress the file first. If you wish
  766.  to write a compression routine and want to incorporate it with DataLoad
  767.  please register such a routine with me so that you do not use conflicting
  768.  header bytes that may have been allocated to another compression routine.
  769.  Currently no compression routines have been defined but I expect this
  770.  to change real soon...
  771.  
  772.  Version History
  773.  +---------+--------------------------------------------------------------+
  774.  | Version | Comments.                                                    |
  775.  +---------+--------------------------------------------------------------+
  776.  | 1.00    | The complement to the DataPlayerModule DataLoad maintains up |
  777.  |         |  eight files in the RMA and attaches them appropriately to   |
  778.  |         |  the DataVoxPlayer channels. (16-Feb-1991)                   |
  779.  | 1.01    | Added to the loader SWI the added commands for the modules   |
  780.  |         |  file type. The file type stores in it the pitch,type,timing |
  781.  |         |  control,offset to data and data itself for a Noise. Filetype|
  782.  |         |  &401 is used. (16-Feb-1991)                                 |
  783.  | 1.02    | Corrected a loading routine error that didn't release memory |
  784.  |         |  before it claimed more memory resulting in a rapidly        |
  785.  |         |  increasing RMA Space... (16-Feb-1991)                       |
  786.  | 1.03    | Added the save SWI to store sounds back to disk...(suprise,  |
  787.  |         |  surprise..) (18-Feb-1991)                                   |
  788.  | 1.04    | Added a nice wee OSCLI command interface to allow the loading|
  789.  |         |  ,saving and clearing of files from or to DataChannels.      |
  790.  |         |  (19-Feb-1991)                                               |
  791.  | 1.05    | Updated the save code to give more meaningful errors (It was-|
  792.  |         |  n't before). (05-Apr-1991)                                  |
  793.  | 1.06    | Updated the save so that it passes the errors from the filing|
  794.  |         |  system ,which are the most meaningful! (21-Apr-1991)        |
  795.  | 1.07    | Added the ability to load Armadeus samples and make a reason-|
  796.  |         |  able approximation of their playing speed. Also now loads   |
  797.  |         |  DSEdit raw sound files but it makes no guess as to their    |
  798.  |         |  playing speed - this must be set by the user. (19-May-1991) |
  799.  | 1.08    | Corrected an embarrasing error with the DataLoad command that|
  800.  |         |   caused only DataChannel 1's pitch to affected when loading |
  801.  |         |   correctly typed files. (08-Jun-1991)                       |
  802.  | 1.09    | Corrected to work with the non-standard OS_File behaviour of |
  803.  |         |   Arcfs v0.30 which played silly buggers with the load       |
  804.  |         |   address in R2 from OS_File 255. Reduced code size by a     |
  805.  |         |   whole 4 bytes! Amazing huh for fixing an error I shouldn't |
  806.  |         |   have had to in the first place! (06-Jul-1991)              |
  807.  | 1.10    | Finally got a working formula for kHz to pitch mapping and   |
  808.  |         |   have corrected DataLoad to use it. Now it always maps the  |
  809.  |         |   right speed. (15-Jul-1991)                                 |
  810.  | 1.11    | Updated to work with version 3.07 of DataPlay. It will now   |
  811.  |         |   save/restore the reverse flag and the repeated area        |
  812.  |         |   settings. Also due to the new facilities of DataPlay it    |
  813.  |         |   reliably copes with Armadeus files. (31-Aug-1991)          |
  814.  | 1.12    | Fixed an error in the Armadeus file loading code. I wonder   |
  815.  |         |   who forgot about little things like channel numbers... :-) |
  816.  |         |   (31-Aug-1991)                                              |
  817.  | 1.13    | Added the FindBuffer SWI to allow applications using DataLoad|
  818.  |         |   to manipulate the stored data directly. (01-Sep-1991)      |
  819.  | 1.14    | Fixed an error in the Loading Code that dealt with Format 2  |
  820.  |         |   files. (08-Sep-1991)                                       |
  821.  | 1.15    | Extended the Save code to cope with the extended version of  |
  822.  |         |   SetRepeat SWI. (08-Sep-1991)                               |
  823.  | 1.16    | Fixed a intermittant error in the Save code that was causing |
  824.  |         |   errors when doing file loads. (16-Oct-1991)                |
  825.  | 2.00    | The all new singing and dancing version of Dataload. It      |
  826.  |         |   supports mulitple files and a whole lot more...            |
  827.  |         |   (04-Nov-1991)                                              |
  828.  | 2.01    | Fixed the IFF 8SVX load code to correctly interpret the speed|
  829.  |         |   of the file. (05-Nov-1991)                                 |
  830.  | 2.02    | Optimized the Restore Code to only use Pitch independance    |
  831.  |         |   neccessary so that in normal use all 16 bits of the Pitch  |
  832.  |         |   are significant.(Otherwise only eight are...) (08-Nov-1991)|
  833.  | 2.03    | Corrected the IFF load code to correctly recognise Stereo &  |
  834.  |         |   non-stereo samples. Also corrected the load scan to make it|
  835.  |         |   more efficient. (08-Nov-1991)                              |
  836.  | 2.04    | Added the QueryAssign SWI to allow applications to do 'smart'|
  837.  |         |   decisions about whether or not to use the AssignSlot SWI.  |
  838.  |         |   (12-Nov-1991)                                              |
  839.  | 2.05    | Added SUN audio file load code and corrected a possible error|
  840.  |         |   in IFF file load and the Create Slot SWI. (15-Nov-1991)    |
  841.  | 2.06    | Altered the PitchWrite code to stop uneccessary pitch conver-|
  842.  |         |   sions. (19-Nov-1991)                                       |
  843.  | 2.07    | Correct an error in the range checking of the ClearSlot SWI. |
  844.  |         |   Because of this error some slot numbers passed to the SWI  |
  845.  |         |   could lock the machine up. (20-Nov-1991)                   |
  846.  | 2.08    | Corrected a minor, non fatal, error in the load code that    |
  847.  |         |   caused it to refuse to load some samples claiming a lack   |
  848.  |         |   of RMA space! Guess who was letting a V flag slide....     |
  849.  |         |   I never knew a CMP could set the V Flag.... (16-Dec-1991)  |
  850.  | 2.09    | Added 16 bit data support with a 16 bit flag. If set the     |
  851.  |         |   sample data is treated as described in the file format     |
  852.  |         |   section. (29-Dec-1991)                                     |
  853.  | 2.10    | Added the support needed for the UpCall code format.         |
  854.  |         |   (16-Jan-1992)                                              |
  855.  | 2.11    | Corrected a minor error in the DSEdit load code. Also altered|
  856.  |         |   it to not call its own SWI's except by BL. (2-Feb-1992)    |
  857.  | 2.12    | Corrected a R12 corruption error in the OSCLI interface. I   |
  858.  |         |   knew I shouldn't have listened to Julian on those mods he  |
  859.  |         |   suggested.... :-) (12-Feb-1992)                            |
  860.  | 2.13    | Received the SWI, Error and Wimp message chunk allocation.   |
  861.  |         |   Hardcoded these values in. (18-Apr-1992)                   |
  862.  | 2.14    | Fixed up an error or three in CreateSlot code. Corrected a   |
  863.  |         |   mistake in the Save code. Adjusted the module to use the   |
  864.  |         |   freshly allocated Filetype number of &108. (19-May-1992)   |
  865.  | 2.15    | Corrected the initialisation procedure to check for the      |
  866.  |         |   correct version of DataVox as well as it's prescense.      |
  867.  |         |   (15-Jun-1992)                                              |
  868.  | 2.16    | Minor fix to CreateSlot - R1 was returning a position 28     |
  869.  |         |   bytes higher than it should be. (21-Jun-1992)              |
  870.  | 2.17    | Fix to Extend Slot - now it won't clear out the entire slot  |
  871.  |         |   when extending a block, only the new extension area.       |
  872.  |         |   All file paths are stored as full ones now. ReadData type  |
  873.  |         |   16 (ReadFullName) has been added to reflect this change.   |
  874.  |         |   DataVox Type III files are now recognised by both the      |
  875.  |         |   filetype and by word 5 of the header, thus DvoxIII files   |
  876.  |         |   will be correctly loaded regardless of filetype.           |
  877.  |         |   (27-Aug-1992)                                              |
  878.  | 2.18    | Due to the RMA Memory Manager behaving weirdly the zero size |
  879.  |         |   has had to be removed. It now quietly ignores the call.    |
  880.  |         |   (04-Sep-1992)                                              |
  881.  | 2.19    | Thanks to some information from Acorn regarding a typing     |
  882.  |         |   error in the PRMs the ExtendSlot SWI now works *properly*  |
  883.  |         |   inclusive of the zero size 'RMA re-shuffle' trick.         |
  884.  |         |   (14-Sep-1992)                                              |
  885.  | 2.20    | Fixed an error in Type III file loading for when the header  |
  886.  |         |   has a zero, and thus badly formed, uncompressed size field.|
  887.  |         |   Corrected CreateSlot to correctly set the uncompressed size|
  888.  |         |   as it should. (24-Sep-1992)                                |
  889.  | 2.21    | Corrected an error in the load routine introduced by the     |
  890.  |         |   bug 'fix' of 2.20 on the uncompressed header size. Thank   |
  891.  |         |   goodness for DDT's ability to step through modules. Fixed  |
  892.  |         |   Extend Slot to correctly clear out the sample extension to |
  893.  |         |   the proper 'zero sound' value for the DataType.            |
  894.  |         |   (12-Oct-1992)                                              |
  895.  | 2.22    | Add the original format type identifier to DataLoad_Load.    |
  896.  |         |   Now front-ends can know what format the sample was         |
  897.  |         |   originally for information displays. (29-Oct-1992)         |
  898.  | 2.23    | Minor changes to allow negative pitches in Type III files.   |
  899.  |         |   (26-Nov-1992)                                              |
  900.  | 2.24    | Fixed the save SWI to record the new absolute path the file  |
  901.  |         |   is being saved to. (21-Dec-1992)                           |
  902.  | 2.25    | Fixed a minor bug in the load SWI pertaining to incorrect    |
  903.  |         |   handling of the stereo flag in type III files on 'load and |
  904.  |         |   assign' operations. (25-Jan-1993)                          |
  905.  | 2.26    | Corrected an error with Type III compressed file handling.   |
  906.  |         |   (06-Dec-1993)                                              |
  907.  | 2.27    | Adjusted the SWI return code to correctly reset flags when   |
  908.  |         |   exiting. (14-Dec-1993)                                     |
  909.  | 2.28    | Corrected a bug in the name handling routines. Altered the   |
  910.  |         |   default file loading to more useful values. Adjust the IFF |
  911.  |         |   handling code to not get confused over RIFF files.         |
  912.  |         |  (02-Jan-1994)                                               |
  913.  | 2.29    | Adjust the SUN audio file handling to cope with the strange  |
  914.  |         |   header variant that gives an incorrect data size.          |
  915.  |         |   (03-Jan-1993)                                              |
  916.  +---------+--------------------------------------------------------------+